<!doctype html>
<html>
    <head>
        <meta charset="UTF-8">
        <link type="text/css" href="css/style.css" rel="stylesheet" media="screen" />
        <title>Willkommen beim Kneipentest</title>
        <!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
        <!-- 	html5 + CSS 3 Template created by miss monorom  http://intensivstation.ch 2011 -->
        <script type="text/javascript" src="js/libs/jquery/jquery.js"></script>
        <script type="text/javascript" src="js/libs/jquery.tablesorter/jquery.tablesorter.js"></script>
        <script type="text/javascript" src="js/libs/jquery.tableSort.js"></script>
        <script type="text/javascript" src="js/libs/jquery-ui-1.10.4.custom.js"></script>

        <link rel="stylesheet" href="css/jquery-ui.css" />

        <script type="text/javascript">
            $(document).ready(
                    function() {
                        $("#myTable").tablesorter();
                    }
            );
        </script>

        <script>
            $(function() {

                var availableTags = [
                    "ActionScript",
                    "ASP"
                ];

                $("#tags").autocomplete({
                    source: "includes/sucheMitJQueryAutocompleter.php", minLength:2
//                    source: availableTags
                });
            });
        </script>

    </head>
    <body>
        <div id="container">
            <header>
                <h2>Willkommen beim Kneipentest</h2>
            </header>
            <nav>
                <h2>Menue links</h2>
                <ul>
                    <li><a href="index.php?nav=1" title="normale Darstellung">Kneipe anzeigen</a></li>
                    <li><a href="index.php?nav=2" title="mit jQuery Tablesorter-Plugin">Kneipe anzeigen</a></li>
                    <li><a href="index.php?nav=3" title="mit animiertem jQuery Tablesorter-Plugin">Kneipe anzeigen</a></li>
                    <li><a href="index.php?nav=4">Kneipe hinzufügen</a></li>
                </ul>
            </nav>

            <aside>
                <h2>Suche</h2>

                <form method='post' action='<?php echo "{$_SERVER['PHP_SELF']}"; ?>'>
                    <input type='text' name='suchstring' size='28'> <br />
                    <input type='submit' value="Absenden">
                    <input type='reset'>
                    <input type='hidden' name="sent" value="1">
                </form>

                <div class="ui-widget">
                    <label for="tags">Tags: </label>
                    <input id="tags">
                </div>






            </aside>
            <article>
                <h2>Inhalt</h2>
                <?php
//                $navigation = isset($_GET['nav']) ? $_GET['nav'] : '0';
                $navigation = filter_input(INPUT_GET, 'nav', FILTER_SANITIZE_STRING);
                switch ($navigation) {
                    case "0":
                        echo "<h2>Willkommen beim Kneipentest...</h2>";
                        break;
                    case "1":
                        echo "<h2>Kneipen anzeigen (normal)</h2>";
                        include 'includes/kneipenAnzeigen.inc.php';
                        break;
                    case "2":
                        echo "<h2>Kneipen anzeigen (Tablesorter)</h2>";
                        include("includes/kneipenAnzeigen2.inc.php");
                        break;
                    case "3":
                        echo "<h2>Kneipen anzeigen (Animiert:table-sort)</h2>";
                        include("includes/kneipenAnzeigen3.inc.php");
                        break;
                    case "4":
                        echo "<h2>Kneipen hinzufügen</h2>";
                        include("includes/kneipenEintragen.inc.php");
                        break;
                }//switch
                //Wurde das Suchformular ausgefüllt?
                $sent = filter_input(INPUT_POST, 'sent', FILTER_SANITIZE_STRING);
                $suche = filter_input(INPUT_POST, 'suchstring', FILTER_SANITIZE_STRING);
//                $sent = isset($_POST['sent']) ? $_POST['sent'] : '';
//                $suche = isset($_POST['suchstring']) ? $_POST['suchstring'] : '';
                if ($sent and $suche) {
                    echo "<h2>Kneipen suchen</h2>";
                    include 'includes/suchen.inc.php';
                }

                //Wurde das Eintragenformular ausgefüllt?
                $insertsent = filter_input(INPUT_POST, 'insertsent', FILTER_SANITIZE_STRING);

                $kneipenname = filter_input(INPUT_POST, 'kneipenname', FILTER_SANITIZE_STRING);
                $kneipenart = filter_input(INPUT_POST, 'kneipenart', FILTER_SANITIZE_STRING);
                $kneipennote = filter_input(INPUT_POST, 'kneipennote', FILTER_SANITIZE_STRING);
                $kneipenkommentar = filter_input(INPUT_POST, 'kneipennote', FILTER_SANITIZE_STRING);

                echo $insertsent;
                echo $kneipenname;
                echo $kneipenart;
                echo $kneipennote;
                echo $kneipenkommentar;

                if ($insertsent and $kneipenname and $kneipenkommentar) {
                    echo "<h2>Kneipen eintragen</h2>";
                    include 'includes/kneipenEintragenDB.inc.php';
                }


                echo "<button id='b1'>Klick mich an</button>";
                ?>
            </article>
            <footer>		
                <h2>Kneipentest... Viel Spass beim Testen!</h2>
            </footer>
        </div>
    </body>
</html>
